import { defineStore } from "pinia";
import { Names } from "../../store-namespace";
import { _get, _post, _put, _delete, http } from "@/utils/axios";
import { ElNotification } from "element-plus"; //处理导航信息
import { WarningItemObject } from "@/api/backend/index";
import { mapCompanies } from "@/utils/common";

export const useWarningItemObject = defineStore(Names.WarningItemObject, {
  state: () => {
    return {
      single: <any>{},
      tags: <any>{},
      type: <any>[],
      typeCategory: <any>[],
      typeCategoryFormat: <any>[], //字段的数据格式
      fullData: <any>[], //所有告警对象数据
    };
  },
  getters: {},
  actions: {
    //获取告警对象列表数据
    getWarningItemObjectList(filter: any) {
      return new Promise((resolve, reject) => {
        _get(WarningItemObject + "/list", filter, "json", "").then(
          (res: any) => {
            console.log("获取告警对象列表数据", res);
            resolve(res.rows);
          }
        );
      });
    },
  },
});
